#ifndef _SKY_H
#define _SKY_H

//Caelum
#include "Caelum.h"
#include "GameSceneManager.h"

using namespace Ogre;

struct SkyConfig {
	bool isLoaded;
	bool manageLights;
	Real timeScale;
	Real cloudsSpeed;
	Real cloudsCover;
	Real cloudsBendTime;

	ColourValue ambientLight;
	ColourValue diffuseLight;
	ColourValue specularLight;

	ColourValue backgroundColour;
	Real NearClip;
	Real AspectRatio;
	Real FarClip;

	Ogre::FogMode FogType;
	Real FogLineStart;
	Real FogLineEnd;
	Real FogDensity;
	ColourValue FogColour;

	Ogre::ProjectionType ProjType;
	Radian FOVy;

	Ogre::String skyMode;
	Ogre::String skyBoxName;
	
	Ogre::Real skyBoxDistance;
	Ogre::Vector3 camPos;
	Ogre::Real camVel;
};

extern SkyConfig sky_config;

class SkyGenerator
{
private:
	
	Root *mRoot;
	SceneManager* mSceneMgr;
	RenderWindow* mWindow;

public:
	
	caelum::CaelumSystem *mCaelumSystem;

	

	SkyGenerator();
	~SkyGenerator();
	
	void setupSkyBox();
	void destroySkyBox();
	void setupScene();
	void saveAttrib(TiXmlElement* pAttrib);
	void setAttribute(std::string name,std::string value);

	void setDefaultConfig();

	void createSky();
	void UpdateSun();

	//Under construction
	void setupCaelum(void);
	void destroySky(void);

};

#endif